package com.ruoyi.printer.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.printer.domain.vo.UserSelectVo;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 用户管理
 * @author yanyi
 * @date 2023-07-13
 */
@RestController
@RequestMapping("/printer/user")
public class PrinterUserController extends BaseController {
    @Autowired
    private ISysUserService userService;

    /**
     * 查询用户列表
     */
    @GetMapping("/select")
    public AjaxResult list(){
        List<SysUser> list = userService.selectUserList(new SysUser());
        List<UserSelectVo> map = list.stream().map(user->new UserSelectVo(user.getUserId(), user.getUserName())).collect(Collectors.toList());
        return AjaxResult.success(map);
    }
}
